#include <iostream>
#include <string>
using namespace std;

int main()
{
    string str;
    cin >> str;

    string st;
    for (int i = 0; i < str.size(); ++i)
    {
        if (st.size() && st.back() == str[i])
            st.pop_back();
        else
            st += str[i];
    }

    cout << (st.size() == 0 ? "0" : st) << endl;

    return 0;
}